package com.pfzy.lib.common.http;

import androidx.annotation.CallSuper;

import com.pfzy.lib.common.http.util.HttpUtils;
import com.pfzy.lib.net.BaseEntity;
import com.pfzy.lib.net.subscriber.CCSubscriber;

public abstract class CCCXSubscriber<T> extends CCSubscriber<T> {
    boolean mShowError;

    public CCCXSubscriber() { }

    public CCCXSubscriber(boolean showErrorToast) {
        super(showErrorToast);
        this.mShowError = showErrorToast;
    }

    @Override
    @CallSuper
    public boolean onBizError(BaseEntity baseEntity) {
        return ErrorCodeHandler.handle(baseEntity);
    }

    @Override
    public void onFailed(int code, String message) {
        HttpUtils.onFail(this.mShowError, code, message);
    }
}
